{extend name="$_tpl_public_layout_danceadmin"/}


{block name="breadcrumb"}
<ol class="breadcrumb">
	<li class="breadcrumb-item"><a href="{:url('admin/index/index')}">{:config('system.site_title')}</a></li>
	<li class="breadcrumb-item"><a href="{:url('admin/merchantRole/index')}">{$sideName}</a></li>
</ol>
{/block}


{block name="pageheader"}
{$sideName}
{/block}


{block name="content"}
<div class="card mb-3">
	<div class="card-body">
		<form method="post" action="{:url('admin/merchantRole/doNodeAccess')}" class="form-horizontal J_ajaxForm">
			<input type="hidden" name="roleid" value="{$roleid}" />
			<div class="form-group row">
				<label class="col-md-2 control-label">权限分配</label>
				<div class="col-md-5">
					<div class="auth">
						{volist name="nodeList" id="vo"}
							<div class="admin">
								<div class="ud-control ud-checkbox">
									<label class="checkbox-label checkbox-inline">
										<input type="checkbox" name="menu_auth[]" {php}if($vo['checked']) echo "checked";{/php} value="{$vo.id}">
										<span class="ud-control-indicator"></span>
										<span> {$vo['name']}</span>
									</label>
								</div>
							</div>
							<hr>
						{/volist}
					</div>
				</div>
				<div class="col-md-5"></div>
			</div>
			<div class="clearfix form-actions">
				<div class="offset-md-2 col-sm-10">
					<button type="submit" class="btn btn-primary btn-sm J_ajaxSubmit">确认</button>
				</div>
			</div>
		</form>
	</div>
</div>
{/block}


{block name="script"}
<script type="text/javascript">
$(function(){
	//遍历选中当前权限的子权限
	$('.auth input[type="checkbox"]').on('change',function(){
		$('.'+$(this).attr('data-depend-name')+' .auth'+$(this).val()).find('input').prop('checked',this.checked);
	});
});
</script>
{/block}